from django.urls import path,include
#
from django.views.static import serve
from rest_framework.routers import DefaultRouter

from goods.views import SkuListViewSet, phoneViewSet, PcViewSet, GoodsDetail, SpuListViewSet

# router = DefaultRouter()
# router.register(r'goods', GoodsListViewSet)

urlpatterns = [
    #配置上传文件的访问处理函数
    # path('media/<path:path>',serve,{'document_root':MEDIA_ROOT}),
    # path('',include(router.urls))
    path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),

    path('sku/', SkuListViewSet.as_view({'get':'list',}),name='sku'),

    path('spu/', SpuListViewSet.as_view({'get':'list',}),name='spu'),

    path('phone/', phoneViewSet.as_view({'get':'list',}),name='phone'),
    path('computer/', PcViewSet.as_view({'get':'list',}),name='computer'),

    path('goods/<int:bid>/<int:sid>', GoodsDetail,name='goodsdetail'),
]


